package io.lvdaxian.handwriting.lambda;

import io.lvdaxian.handwriting.po.User;
import org.junit.Before;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

/**
 * removeIf 表达式的测试
 *
 * @author lihh
 */
public class RemoveIfTest {
  
  private final static List<User> users = new ArrayList<>();
  
  @Before
  public void testCase000() {
    for (int idx = 10; idx < 20; idx += 1) {
      users.add(new User(idx));
    }
  }
  
  @Test
  public void testCase001() {
    // 通过 lambda表达式 将元素删除
    users.removeIf(l -> l.getAge() % 2 == 0);
    users.forEach(System.out::println);
  }
}
